home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectPlay / SimpleVoice / modDplay.bas < prev    next >
BASIC Source File  |  2001-10-08  |  2KB  |  57 lines

  1. Attribute VB_Name = "modDplay"
  2. Option Explicit
  3. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  4. '
  5. '  Copyright (C) 1999-2001 Microsoft Corporation.  All Rights Reserved.
  6. '
  7. '  File:       modDPlay.bas
  8. '
  9. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  10.  
  11. 'Constants
  12. Public Const AppGuid = "{F5230441-9B71-88DA-998C-00207547A14C}"
  13.  
  14. 'Types
  15. Public Type PlayerInfo
  16.     lPlayerID As Long
  17.     fSilent As Boolean
  18. End Type
  19.  
  20. 'DirectX Variables
  21. Public dvServer As DirectPlayVoiceServer8
  22. Public dvClient As DirectPlayVoiceClient8
  23. Public dx As DirectX8
  24. Public dpp As DirectPlay8Peer
  25. Public glMyID As Long
  26. 'Our connection form and message pump
  27. Public DPlayEventsForm As DPlayConnect
  28.  
  29. 'Misc Vars
  30. Public fAmHost As Boolean
  31.  
  32. ' Get the DirectPlay objects
  33. Public Sub InitDPlay()
  34.     Set dx = New DirectX8
  35.     Set dpp = dx.DirectPlayPeerCreate
  36. End Sub
  37. ' Shut down the DPlay objects
  38. Public Sub Cleanup()
  39.     
  40.     On Error Resume Next
  41.     'Turn off our error handling
  42.     If Not (dpp Is Nothing) Then dpp.UnRegisterMessageHandler
  43.     If Not (dvClient Is Nothing) Then dvClient.UnRegisterMessageHandler
  44.     If Not (dvServer Is Nothing) Then dvServer.UnRegisterMessageHandler
  45.     dvClient.Disconnect DVFLAGS_SYNC
  46.     If fAmHost Then dvServer.StopSession 0
  47.     'Destroy the objects
  48.     Set dvClient = Nothing
  49.     Set dvServer = Nothing
  50.     
  51.     If Not dpp Is Nothing Then dpp.Close
  52.     DPlayEventsForm.GoUnload
  53.     'Destroy the objects
  54.     Set dpp = Nothing
  55.     Set dx = Nothing
  56. End Sub
  57.